package com.csyf.manager.config;

import cn.com.sand.online.agent.service.sdk.ConfigurationManager;
import cn.com.sand.online.agent.service.sdk.DynamicPropertyHelper;
import cn.com.sandpay.cashier.sdk.util.CertUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class MyStartupRunner implements CommandLineRunner {

    @Override
    public void run(String... args) throws Exception {
        System.out.println(">>>>>>>>>>>>>>>服务启动执行，执行加载数据等操作<<<<<<<<<<<<<");
        ConfigurationManager.loadProperties(new String[]{"dsfpconfig"});
//
//        String publicKeyPath = DynamicPropertyHelper.getStringProperty("dsfp.encrypt.publickey", "").get();
//        String privateKeyPath = DynamicPropertyHelper.getStringProperty("dsfp.encrypt.privatekey", "").get();
//        String keyPassword = DynamicPropertyHelper.getStringProperty("dsfp.encrypt.password", "").get();
        try {
//            log.info("==>开始加载证书, sandPubCertPath:{}, midPriCertPath:{}, midPriCertPwd不显示", publicKeyPath, privateKeyPath);
//            CertUtil.init(publicKeyPath, privateKeyPath, keyPassword);
            log.info("<==结束加载证书");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}